/* debug.c

Copyright (C) Alex S. (mailto: md5sum@alexsp.ru)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details
http://www.gnu.org/licenses/gpl-2.0.html.

You should have received a copy of the GNU General Public License
along with this program in the file gpl-2.0.txt;
if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include "usart.h"
//#include <string.h>
#ifdef USE_DEBUG

char debug_str[20];

//char usart_rx_buff[20];
//uint8_t rx_str_flag=0;
//uint8_t rx_len=0;

void debug(const char * str){
	char * p=(char *)str;

	while (*p) {
#if USE_Watchdog==1
		wdt_reset();
#endif /* USE_Watchdog */
		while (!(UCSRA&(1<<UDRE)));
		UDR=*p;
		p++;
	}
}

/*
ISR(USART_RXC_vect){
	uint8_t tmp;

	tmp=UDR;
	UDR=tmp;
	if (rx_str_flag) return;

	usart_rx_buff[rx_len]=tmp;
	if (tmp=='\r') {
		usart_rx_buff[rx_len]=0;
		rx_str_flag=1;
	}
	rx_len++;
	if (rx_len>=sizeof(usart_rx_buff)) rx_len=0;
}

*/
#endif
